﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Microsoft.Practices.Composite.Modularity;
using Microsoft.Practices.Composite.Regions;
using Microsoft.Practices.Unity;
using RiaCrm.DataAccessLayer;
using RiaCrm.Infrastructure;
using Acando.Dynamics.CRM.Silverlight.Library.Interfaces;

namespace RiaCrm.DynamicEntityGrid
{
    public class DynamicEntityModule : IModule
    {
        private IRegionManager _regionManager;
        private IUnityContainer _container;

        public DynamicEntityModule(IRegionManager regionManager, IUnityContainer container)
        {
            this._container = container;
            this._regionManager = regionManager;
        }

        # region IModule Members

        public void Initialize()
        {
            //this._container.RegisterInstance("EntityName", "account", new ContainerControlledLifetimeManager());
            //this._container.RegisterInstance(new InitParaEntityname { Value = "customer" }, new ContainerControlledLifetimeManager());
            
            this._container.RegisterType<IMetaDataLayer, MetaDataLayer>(new ContainerControlledLifetimeManager() );
            this._regionManager.RegisterViewWithRegion("TopResultsRegion", typeof(DynamicEntityGridView));
        }

        # endregion

    }
}
